package com.ztom.test

import com.ztom.beans.factory.support.pojo.BeanDefinition
import com.ztom.beans.factory.DefaultListableBeanFactory
import com.ztom.test.service.TestService
import kotlin.test.Test

/**
 * @author ZhangTao
 */
class Test01BeanDefinition {

    @Test
    fun test() {
        val beanFactory = DefaultListableBeanFactory()
        val beanDefinition = BeanDefinition(TestService::class)
        beanFactory.registerBeanDefinition("testService", beanDefinition)

        val bean = beanFactory.getBean("testService")
        assert(bean is TestService)
        val testService = bean as TestService
        testService.doTest()
    }
}